<?php

//获取销售人员名称
function getsalename($ord)
{
    $couponhis = M("couponhis");
    $disisbn = M("disisbn");
    $salestaff = M("salestaff");
    $code = $couponhis->where("cou_orders='" . $ord . "'")->find();
    $usr = $disisbn->find($code["cou_disid"]);
    $info = $salestaff->find($usr["dis_ssaid"]);
    return $info["ssa_name"];
}

/**
 * 发送短信
 * @param type $val
 * @param type $phone
 * @return boolean
 */
function sentsms($code, $val, $phone)
{
    $sms = D("Analysis/Textchel");
    $smstovic = M("smstovic");
  #  $info = $sms->getSmsParam($phone, $val);
   # $status = explode(",", $info);
    $status[1] = 0;
    if ($status[1] == 0) {
        $data = array("stc_code" => $code, "stc_phone" => $phone, "stc_time" => time());
        $smstovic->add($data);
        return true;
    }
    return false;
}

function cn_datetime($date)
{
    return date('Y-m-d H:i:s', $date / 1000);
}

function total_amount($amount)
{
    return $amount / 0.3;
}

function total_commission($amount)
{
    return $amount * 0.3 / 100;
}
